package test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class QueryPostNumber extends HttpServlet{
	@Override
	protected void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
		String number=request.getParameter("number");
		RequestDispatcher rd=null;
		if(number!=null) {
			PostNumberCon pnc=new PostNumberCon();
			PostNumber pn=pnc.getOne(number);
			if(pn!=null) {
				request.setAttribute("pn", pn);
				rd=request.getRequestDispatcher("result.jsp");
			}
		}
		if(rd==null) {
			rd=request.getRequestDispatcher("query.jsp");
		}
		rd.forward(request, response);
	}
	@Override
	protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
		doPost(request,response);
	}
}
